{
GType widget_type;
GParamSpec *pspec;
+ GtkStateFlags state;
GValue value;
};
const PropertyValue *val1 = bsearch_node1;
const PropertyValue *val2 = bsearch_node2;
- if (val1->widget_type == val2->widget_type)
- return val1->pspec < val2->pspec ? -1 : val1->pspec == val2->pspec ? 0 : 1;
- else
+ if (val1->widget_type != val2->widget_type)
return val1->widget_type < val2->widget_type ? -1 : 1;
+
+ if (val1->pspec != val2->pspec)
+ return val1->pspec < val2->pspec ? -1 : 1;
+
+ if (val1->state != val2->state)
+ return val1->state < val2->state ? -1 : 1;
+
+ return 0;
}
const GValue *
_gtk_style_context_peek_style_property (GtkStyleContext *context,
GType widget_type,
+ GtkStateFlags state,
GParamSpec *pspec)
{
GtkStyleContextPrivate *priv;
data = style_data_lookup (context);
key.widget_type = widget_type;
+ key.state = state;
key.pspec = pspec;
/* need value cache array */
global = global->prev;
if (gtk_style_provider_get_style_property (provider_data->provider,
- priv->widget_path, pspec,
- &pcache->value))
+ priv->widget_path, state,
+ pspec, &pcache->value))
{
/* Resolve symbolic colors to GdkColor/GdkRGBA */
if (G_VALUE_TYPE (&pcache->value) == GTK_TYPE_SYMBOLIC_COLOR)
{
GtkStyleContextPrivate *priv;
GtkWidgetClass *widget_class;
+ GtkStateFlags state;
GParamSpec *pspec;
const GValue *peek_value;
GType widget_type;
return;
}
- peek_value = _gtk_style_context_peek_style_property (context,
- widget_type,
- pspec);
+ state = gtk_style_context_get_state (context);
+ peek_value = _gtk_style_context_peek_style_property (context, widget_type,
+ state, pspec);
if (G_VALUE_TYPE (value) == G_VALUE_TYPE (peek_value))
g_value_copy (peek_value, value);
{
GtkStyleContextPrivate *priv;
const gchar *prop_name;
+ GtkStateFlags state;
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
if (!priv->widget_path)
return;
+ state = gtk_style_context_get_state (context);
+
while (prop_name)
{
GtkWidgetClass *widget_class;
continue;
}
- peek_value = _gtk_style_context_peek_style_property (context,
- widget_type,
- pspec);
+ peek_value = _gtk_style_context_peek_style_property (context, widget_type,
+ state, pspec);
G_VALUE_LCOPY (peek_value, args, 0, &error);
* gtk_style_provider_get_style_property:
* @provider: a #GtkStyleProvider
* @path: #GtkWidgetPath to query
+ * @state: state to query the style property for
* @pspec: The #GParamSpec to query
* @value: (out): return location for the property value
*
gboolean
gtk_style_provider_get_style_property (GtkStyleProvider *provider,
GtkWidgetPath *path,
+ GtkStateFlags state,
GParamSpec *pspec,
GValue *value)
{
if (!iface->get_style_property)
return FALSE;
- return iface->get_style_property (provider, path, pspec, value);
+ return iface->get_style_property (provider, path, state, pspec, value);
}
/**
{
GtkStyleContext *context;
const GValue *peek_value;
+ GtkStateFlags state;
context = gtk_widget_get_style_context (widget);
+ state = gtk_widget_get_state_flags (widget);
+
peek_value = _gtk_style_context_peek_style_property (context,
G_OBJECT_TYPE (widget),
- pspec);
+ state, pspec);
/* auto-conversion of the caller's value type
*/
va_list var_args)
{
GtkStyleContext *context;
+ GtkStateFlags state;
const gchar *name;
g_return_if_fail (GTK_IS_WIDGET (widget));
g_object_ref (widget);
context = gtk_widget_get_style_context (widget);
+ state = gtk_widget_get_state_flags (widget);
name = first_property_name;
while (name)
peek_value = _gtk_style_context_peek_style_property (context,
G_OBJECT_TYPE (widget),
- pspec);
+ state, pspec);
G_VALUE_LCOPY (peek_value, var_args, 0, &error);
if (error)